package tx.hw.teacher.demo01.t1;

/**
 * 男孩 - 线程
 * @author lwj
 * @date 2025-03-14
 * @vesion 1.0.0
 */
public class BoyThread extends Thread{
    /**
     * 男孩要用的篮子
     */
    private Box box;
    /**
     * 姓名
     */
    private String name;

    // 构造方法
    public BoyThread() {}
    public BoyThread(Box box, String name) {
        this.box = box;
        this.name = name;
    }

    @Override
    public void run() {
        while(true){
            // 摘水果
            Fruit fruit = new Fruit();
            box.put(name,fruit);
        }
    }
}
